package com.bootdo.lvyou.dao;

import com.bootdo.lvyou.domain.LvyouPunchCard;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 打卡
 * @author lujingqian
 * @email 965858129@qq.com
 * @date 2019-10-14 17:25:32
 */
@Mapper
public interface LvyouPunchCardDao {

	LvyouPunchCard get(Long id);
	
	List<LvyouPunchCard> list(Map<String,Object> map);
	
	int count(Map<String,Object> map);
	
	int save(LvyouPunchCard lvyouPunchCard);
	
	int update(LvyouPunchCard lvyouPunchCard);
	
	int remove(Long id);
	
	int batchRemove(Long[] ids);

	@Select("select * from me_lvyou_punch_card where parent_id=#{id} order by create_time desc")
    List<LvyouPunchCard> getByParentId(Long id);

	@Select("select * from me_lvyou_punch_card where parent_id=#{parentId} and member_id=#{memberId}")
    List<LvyouPunchCard> getByParentIidAndMemberId(@Param("memberId") Long memberId,@Param("parentId")Long parentId);

	@Select("select * from me_lvyou_punch_card where parent_id=#{parentId} and member_id=#{memberId} and scenic_id=#{scenicId}")
    List<LvyouPunchCard> getByParentIidAndMemberIdAndScenicSopt(@Param("memberId") Long memberId,@Param("parentId")Long parentId,@Param("scenicId") Long scenicId);

	@Select("select * from me_lvyou_punch_card where parent_id=#{id} order by create_time desc limit #{offset}, #{limit} ")
	List<LvyouPunchCard> getByParentIdLimit(@Param("id") Long id,@Param("offset")Integer offset,@Param("limit")Integer limit);

	@Select("select * from me_lvyou_punch_card where is_read=0 and member_id=#{memberId}")
	List<LvyouPunchCard> selectIsReadCardMessage(@Param("memberId") Long memberId);

	@Select("select * from me_lvyou_punch_card where  member_id=#{memberId}")
	List<LvyouPunchCard> selectIsReadCardMessageAll(@Param("memberId") Long memberId);

	@Select("select count(*) from me_lvyou_punch_card where is_read=0 and member_id=#{memberId}")
	Integer selectIsReadCardMessageNumber(Long memberId);
}
